@inject('appRepository', 'App\Repositories\AppRepository')
@extends('layouts.app',['navShow'=>true])
@php
    $banner = $appRepository->getContentByColumn('ContentPicture',5,'新闻页','新闻页banner');
@endphp
@section('title',"培优策-{$name}")
@section('content')
    @if($banner && count($banner))
        <div id="myCarousel" class="carousel slide" data-ride="carousel">
            <ol class="carousel-indicators">
                @foreach($banner as$key=> $item)
                    <li data-target="#myCarousel" data-slide-to="0" class="{{$key===0?'active':''}}"></li>
                @endforeach
            </ol>
            <div class="carousel-inner">
                @foreach($banner as $key=>$item)
                    <div class="carousel-item {{$key===0?'active':''}}">
                        <img class="img-fluid"
                             src="{{$item->content_detail->assets_path}}"
                             alt="First slide">
                        <div class="container">
                            <div class="carousel-caption text-left">
                                <h1>{{$item->title}}</h1>
                            </div>
                        </div>
                    </div>
                @endforeach
            </div>
            <a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev">
                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                <span class="sr-only">Previous</span>
            </a>
            <a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next">
                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
        </div>

    @endif
    <div class="container-fluid news-bg">
        <div class="container py-0 my-5" >
            <div class="row">
                <div class="col-xl-8 col-sm-12 news-list-table ">
                    <div class="row">
                        <div class="content-title mt-3">
                            <div class="content-title-img">
                                <div class="news-list-title"><h3>{{"培优策 - {$name}"}}</h3></div>
                            </div>
                        </div>
                    </div>
                    <div class="row news-list mt-3 pr-3">
                        @foreach($content as $item)
                            <div class="media">
                                    <div class="mr-3 media-time-box">
                                        @php
                                        $time = \Carbon\Carbon::parse($item->created_at);
                                        @endphp
                                        <h3 class="media-day">{{$time->day}}</h3>
                                        <span class="media-time">{{$time->year}}/{{$time->month}} <br>
                                        {{$time->hour}}:{{$time->minute}}</span>
                                    </div>
                                <div class="media-body">
                                    {{--<small class="pull-right text-muted">{{$item->created_at}}</small>--}}
                                    <a href="{{url('content',['id'=>$item->id])}}" target="_blank">
                                        <h4 class="news-title">{{$item->title}}</h4>
                                    </a>
                                    {{$item->keywords}}
                                </div>
                            </div>
                        @endforeach
                    </div>
                    {{ $content->links('layouts.page') }}
                </div>
                <div class=" news-left col-xl-4 col-sm-12">
                    @include('layouts.left')
                </div>
            </div>
        </div>

    </div>

@endsection
